#ifndef _IIC_CURRENT_H_
#define _IIC_CURRENT_H_

#include <stdbool.h>
#include <integer.h>
#include "sys.h"
#include "usbd_cdc.h"

#define u8 uint8_t
#define u16 uint16_t
#define BYTE uint8_t
#define WORD uint16_t
#define DWORD uint32_t

//#define LOW 0
//#define HIGH 1
//#define ACK 0
//#define NAK 1
//#define FALSE 0
//#define TRUE  1
//#define enum {FALSE = 0, TRUE = !FALSE} bool;

#define CHAR  int8_t   	
#define BYTE  uint8_t  	 
#define WORD  uint16_t 	 
#define DWORD uint32_t 	 

#define FALSE 0
#define TRUE  1

//typedef enum  {FALSE = 0, TRUE = !FALSE} bool;

#define LOW 0
#define HIGH 1
#define ACK LOW
#define NAK HIGH

#define DeviceAddr_AVDD		0x88
#define DeviceAddr_ELVDD	0x80
#define DeviceAddr_VCI	  0x82
#define DeviceAddr_VDDIO	0x8A

#define DeviceAddr_VBAT		0x8E
#define DeviceAddr_DVDD		0x90

void T226_Init(void);
void T226_GPIO_Init(void);
u8 T226_intion(u8 addr);
void T226_GPIO_Config(void);
bool T226_I2CSend(BYTE ucDeviceAddr, BYTE ucIndex,u16 reg);
bool T226_I2CReceive(BYTE ucDeviceAddr, BYTE ucIndex, u32 *regv);
unsigned long Measure_IDD_once(u8 Addr) ;
u16 MeasureCurrentuA(u8 addr);
u16 MeasureCurrentmA(u8 addr);
void PMU_Oled_Measure(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data);   
void PMU_Oled_Vci_Vddi_Trim(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data);
void PMU_Oled_mAuA_Gear(USBD_HandleTypeDef *pdev,uint8_t  ep_addr,u8 SigMode ,u8 channel,u8* buffer,u16 LP_B7_Data,u16 HS_B7_Data);
void delay_us_sys(u32 Nus);
void Delay(u32 nCount);
void TWait(void);
u8 IIC_Mutl_Write_Read(USBD_HandleTypeDef *pdev, u8 *buf,u8 unDataLength);
bool I2C1Write (u8 ucDeviceAddr, u8 unDataLength,u8 *buf);
#endif /* __IIC_CURRENT_H */


